home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / tahoe / v7.local.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-02-18  |  1.4 KB  |  72 lines

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  */
  12.  
  13. #ifdef notdef
  14. static char sccsid[] = "@(#)v7.local.c    5.4 (Berkeley) 2/18/88";
  15. #endif /* notdef */
  16.  
  17. /*
  18.  * Mail -- a mail program
  19.  *
  20.  * Version 7
  21.  *
  22.  * Local routines that are installation dependent.
  23.  */
  24.  
  25. #include "rcv.h"
  26.  
  27. /*
  28.  * Locate the user's mailbox file (ie, the place where new, unread
  29.  * mail is queued).  In Version 7, it is in /usr/spool/mail/name.
  30.  */
  31.  
  32. findmail()
  33. {
  34.  
  35.     strcpy(copy("/usr/spool/mail/", mailname), myname);
  36.     if (isdir(mailname)) {
  37.         stradd(mailname, '/');
  38.         strcat(mailname, myname);
  39.     }
  40. }
  41.  
  42. /*
  43.  * Get rid of the queued mail.
  44.  */
  45.  
  46. demail()
  47. {
  48.  
  49.     if (value("keep") != NOSTR)
  50.         close(creat(mailname, 0666));
  51.     else {
  52.         if (remove(mailname) < 0)
  53.             close(creat(mailname, 0666));
  54.     }
  55. }
  56.  
  57. /*
  58.  * Discover user login name.
  59.  */
  60.  
  61. username(uid, namebuf)
  62.     char namebuf[];
  63. {
  64.     register char *np;
  65.  
  66.     if (uid == getuid() && (np = getenv("USER")) != NOSTR) {
  67.         strncpy(namebuf, np, PATHSIZE);
  68.         return(0);
  69.     }
  70.     return(getname(uid, namebuf));
  71. }
  72.